{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "\n"
     ]
    }
   ],
   "source": [
    "import base64\n",
    "import io\n",
    "\n",
    "import qrcode\n",
    "\n",
    "\n",
    "text = '' \n",
    "qr = qrcode.QRCode(     \n",
    "    version=1,     \n",
    "    error_correction=qrcode.constants.ERROR_CORRECT_L,     \n",
    "    box_size=10,     \n",
    "    border=1, \n",
    ")\n",
    "qr.make(fit=True) \n",
    "qr.add_data(text)\n",
    "img = qr.make_image()\n",
    "buf = io.BytesIO()\n",
    "img.save(buf,format='PNG')\n",
    "image_stream = buf.getvalue()\n",
    "heximage = base64.b64encode(image_stream)\n",
    "print('data:image/png;base64,' + heximage.decode())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
